17. Database Query Method
Database Query Method
Question:
Start Quiz:
Solution:
INSTRUCTOR NOTE:
Video Corrections
In the solution video, the initialization of the selectionArgs
array at 0:17 is currently:
String selectionArgs = new String[] { PetEntry.GENDERFEMALE };
It should be:
String[] selectionArgs = new String[] { String.valueOf(PetEntry.GENDERFEMALE) };
It contains these two issues:
Issue 1: String selectionArgs should be String[] selectionArgs
Issue 2: Since PetEntry.GENDERFEMALE is an integer, we need to convert it to a String before it can be added to the String array via String.valueOf(PetEntry.GENDERFEMALE)
Useful Quiz Links
[Link to table image](//lh3.googleusercontent.com/vNFwPsw4UfaqgKfId5OtP6Vg8loo5U31JacHEJb7r0dxw85a_JvlxYe_3mu3JprZm98uDbFya1mRQ5a56A=s0#w=1348&h=414
)
Use this gist to answer the quiz question about the table provided here .
For an overview of SQL injection, check out the wikipedia page.
Link to Android Saving Data documentation from video